﻿-- =================================
-- Populate the dbo.Roles table.
-- =================================
declare @t table
(
	[id]   int          not null primary key,
	[name] nvarchar(50) not null unique
);
--
insert into @t([id], [name])
values
(0, N'None'),
(1, N'Managers'),
(2, N'Moderators'),
(4, N'Administrators');
--
merge into [dbo].[Roles] as [target]
using @t as [source] on [target].[Id] = [source].[id]
when matched then
	update set [target].[Name] = [source].[name]
when not matched by target then
	insert ([Id], [Name])
	values ([source].[id], [source].[name])
when not matched by source then
	delete;
go